import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '招标网站名称',
    align:"center",
    dataIndex: 'websiteName'
   },
   {
    title: '招标网站地址',
    align:"center",
    dataIndex: 'websiteUrl'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'websiteDesc'
   },
   {
    title: '上线状态(0-未开始、1-开发中、2-开发完成)',
    align:"center",
    dataIndex: 'onlineStatus'
   },
   {
    title: '频率配置（Cron 表达式，定义任务执行频率）',
    align:"center",
    dataIndex: 'cronExpression'
   },
   {
    title: '上线时间',
    align:"center",
    dataIndex: 'launchTime'
   },
   {
    title: '爬取状态(0-暂停、1-爬取中)',
    align:"center",
    dataIndex: 'crawlStatus'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '招标网站名称',
    field: 'websiteName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标网站名称!'},
          ];
     },
  },
  {
    label: '招标网站地址',
    field: 'websiteUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入招标网站地址!'},
          ];
     },
  },
  {
    label: '备注',
    field: 'websiteDesc',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入备注!'},
          ];
     },
  },
  {
    label: '频率配置（Cron 表达式，定义任务执行频率）',
    field: 'cronExpression',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入频率配置（Cron 表达式，定义任务执行频率）!'},
          ];
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  websiteName: {title: '招标网站名称',order: 0,view: 'text', type: 'string',},
  websiteUrl: {title: '招标网站地址',order: 1,view: 'text', type: 'string',},
  websiteDesc: {title: '备注',order: 2,view: 'text', type: 'string',},
  onlineStatus: {title: '上线状态(0-未开始、1-开发中、2-开发完成)',order: 3,view: 'number', type: 'number',},
  cronExpression: {title: '频率配置（Cron 表达式，定义任务执行频率）',order: 4,view: 'text', type: 'string',},
  launchTime: {title: '上线时间',order: 5,view: 'datetime', type: 'string',},
  crawlStatus: {title: '爬取状态(0-暂停、1-爬取中)',order: 6,view: 'number', type: 'number',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}